package com.cskaoyan.javase.oop2._2polymorphic._3exercise;
/**
 * 小练习
 * @since 16:20
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        Father f = new Son();
        System.out.println(f.a);
        System.out.println(f.b);
        System.out.println(Father.c);
        // System.out.println(f.aa); 父类中没有aa
        System.out.println("----------------");
        Son s = new Son();
        System.out.println(s.a);
        System.out.println(s.b);
        System.out.println(Son.c);
        System.out.println(s.aa);
        System.out.println("----------------");
        //f.testSon(); 父类中没有该方法
        f.test();
        f.testFather();
        System.out.println("----------------");
        s.test();
        s.testSon();
        s.testFather();
    }
}
class Father {
    int a = 10;
    final int b = 100;
    static final int c = 1000;
    public void test() {
        System.out.println("Father");
    }
    public void testFather() {
        System.out.println("Only Father");
    }
}
class Son extends Father {
    int a = 20;
    final int b = 200;
    static final int c = 10000;
    int aa = 20;
    @Override
    public void test() {
        System.out.println("Son");
    }
    public void testSon() {
        System.out.println("Only Son");
    }
}